<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">会员姓名</label>
            <div class="layui-input-block">
                <input type="text" name="name" value="{$vo.name|default=''}" required placeholder="请输入会员姓名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-inline" style="width: 260px;">
                <input type="text" name="phone" value="{$vo.phone|default=''}" placeholder="请输入手机号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">必须唯一</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-block">
                <input type="text" name="id_card" value="{$vo.id_card|default=''}" placeholder="请输入身份证号" class="layui-input" maxlength="18">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">磁卡号</label>
            <div class="layui-input-inline" style="width: 260px;">
                <input type="text" name="card_no" value="{$vo.card_no|default=''}" required placeholder="请输入磁卡号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">必须唯一，可用于刷卡打卡</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">头像图片</label>
            <div class="layui-input-block">
                <input type="hidden" name="img" value="{$vo.img|default=''}" data-type="jpg,jpeg,png,gif" data-size="0">
                <div class="layui-form-mid layui-word-aux">用于人脸识别，建议上传清晰的正面照片，支持jpg/png格式，最大2MB</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-inline" style="width: 260px;">
                <input type="password" name="password" value="" placeholder="{if isset($vo.id)}留空不修改{else/}可留空或设置初始密码{/if}" class="layui-input" autocomplete="new-password">
            </div>
            <div class="layui-form-mid layui-word-aux">后台保存时自动加密存储</div>
        </div>
        {if $isMaster}
        <div class="layui-form-item">
            <label class="layui-form-label">注册门店</label>
            <div class="layui-input-block">
                <select name="register_store_id" required>
                    <option value="">请选择注册门店</option>
                    {foreach $stores as $s}
                    <option value="{$s.id}" {eq name='vo.register_store_id|default=0' value='$s.id'}selected{/eq}>{$s.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {else/}
        <input type="hidden" name="register_store_id" value="{$vo.register_store_id|default=$storeId}">
        {/if}
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="正常" {eq name='vo.status|default=1' value='1'}checked{/eq}>
                <input type="radio" name="status" value="0" title="禁用" {eq name='vo.status|default=1' value='0'}checked{/eq}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="请输入备注" class="layui-textarea">{$vo.remark|default=''}</textarea>
            </div>
        </div>
        {notempty name='vo.id'}
        <div class="layui-form-item">
            <label class="layui-form-label">积分信息</label>
            <div class="layui-input-inline" style="width: 160px;">
                <input type="number" name="total_points" value="{$vo.total_points|default='0'}" readonly class="layui-input">
                <div class="layui-form-mid layui-word-aux">累计积分</div>
            </div>
            <div class="layui-input-inline" style="width: 160px;">
                <input type="number" name="used_points" value="{$vo.used_points|default='0'}" readonly class="layui-input">
                <div class="layui-form-mid layui-word-aux">已用积分</div>
            </div>
            <div class="layui-input-inline" style="width: 160px;">
                <input type="number" name="available_points" value="{$vo.available_points|default='0'}" class="layui-input">
                <div class="layui-form-mid layui-word-aux">可用积分</div>
            </div>
        </div>
        {/notempty}
        <div class="hr-line-dashed"></div>
        <div class="layui-form-item text-center">
            {notempty name='vo.id'}
            <input type="hidden" name="id" value="{$vo.id}">
            {/notempty}
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" type="button" data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
        </div>
    </div>
</form>

<script>
// 使用ThinkAdmin的上传组件
$(function() {
    // 初始化图片上传组件
    $('input[name="img"]').uploadOneImage();
});
</script>

